<!DOCTYPE html>
 <html>
 <head>
 <meta http-equiv="X-UA-Compatible" content="IE=edge">
 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
 <% include("/view/console/common/css.html"){}	%>

 <title></title>
 </head>
 <body>
 <div class="zq-form">
 <form name="wnFarm_form"  id="wnFarm_form" class="form-horizontal" style="margin-bottom: 70px;">
   <div class="form-group" >
 <label class="col-sm-2 col-xs-2 control-label">农场名称</label>
 <div class="col-sm-6 col-xs-6">
 <input  type="text"  name="name" id="name" class="form-control" check-type="required" value='${wnFarm.name!}' >
 </div>
  </div>
 <div class="form-group" >
 <label class="col-sm-2 col-xs-2 control-label">状态</label>
 <div class="col-sm-6 col-xs-6">
 <div class="radio">
 <label><input checked='checked' auto_name='wnFarm_state' type="radio"  name="state" value="1"/>正常</label>
 <label><input  auto_name='wnFarm_state' type="radio"  name="state" value="0"/>不可用</label>
  
 </div>
 </div>
  </div>
 
   <input type='hidden' name='id' id='id' value='${wnFarm.id!}'><input type='hidden' name='common_token' id='common_token' value='${common_token!}'>
 </form>
  <nav class="navbar navbar-default navbar-fixed-bottom" style="text-align: right">
    <a href="#" class="btn btn-success" style="margin:10px"  onclick='saveZqForm()'>保存 </a>
  </nav>
 </div>
 <% include("/view/console/common/js.html"){} 	%>
 <script>

     layui.use(['layer','laydate'], function(){

     });
     $(function($) {
      /*开启表单验证*/
         $("#wnFarm_form").validation();
         $('input[auto_name="wnFarm_state"]').each(function(){
             if('${wnFarm.state!}'==this.value){
                 $(this).attr('checked','checked');
             }
         });

     });
     /*保存*/
     function saveZqForm(){
         if ($("#wnFarm_form").valid() == false) {
             return false;
         }
         var formObject=new Object();
         formObject.name=$('#name').val()==''?null:$('#name').val();
         formObject.state=($('input[name="state"]:checked').val()==''?null:$('input[name="state"]:checked').val());
         formObject.id=$('#id').val()==''?null:$('#id').val();

         var formObjectJson = JSON.stringify(formObject);
         zqPost("/console/wn_farm/save",
             {
                 formObjectJson :formObjectJson,
                 common_token :$("#common_token").val()
             }, function(data) {
                 layer.alert(data.message, {skin: 'layui-layer-molv',closeBtn: 0 }, function(){
                     parent.$("#wnFarm").bootstrapTable("refresh");
                     parent.layer.closeAll();
                 });

             });
     }
 </script>
 <script type='text/javascript' src='/view/console/wnFarm/wnFarmForm.js'></script>
 </body>
